﻿using System;
using System.Collections.Generic;

namespace TSharp.Core.Mvc.Web
{
    internal static class MvcExtension
    {
        /// <summary>
        ///     Fireds the specified evt list.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="evtList">The evt list.</param>
        /// <param name="action">The action.</param>
        /// <param name="args">
        ///     The <see cref="TSharp.Core.AppEventArgs" /> instance containing the event data.
        /// </param>
        public static void Fired<T>(this IEnumerable<T> evtList, Action<T, AppEventArgs> action, AppEventArgs args)
        {
            foreach (T t in evtList)
            {
                if (args.Cancel) break;
                action(t, args);
            }
        }
    }
}